﻿@model SupportWebsite.Models.SmartTechParticipantModel
@{
    ViewBag.Title = "Registration";
    Layout = "~/Views/Front/MasterPage.cshtml";
}

<script language="javascript" type="text/javascript">
    function addOption(selectbox, text, value) {
        var optn = document.createElement("OPTION");
        optn.text = text;
        optn.value = value;
        selectbox.options.add(optn);
    }
    function AddOptionsList() {
        var selectbox = document.forms["InputForm"]["Interview"];
        for (var i = selectbox.length - 1; i > 0; i--)
            selectbox.remove(i);
        var jarrs;
        $.ajax({
            url: '@Url.Action("GetInterviews", "SmartTech")',
            async: false,
            success: function (msg) {
                jarrs = msg;
            }
        });
        var X = jarrs.split('|');
        //alert(X);
        var size = X[0];
        for (i = 1; i <= size*2; i+=2) {
            addOption(selectbox, X[i+1], X[i]);
        }
        if (jarrs == "")
            addOption(selectbox, "No available dates!", "No available dates!");
    }
</script>

<a href="@Url.Action("Edit", "SmartTech")">Edit</a>
||
<a href="@Url.Action("SendMail", "SmartTech")">SendMail</a>
||
<a href="@Url.Action("Print", "SmartTech")">Print</a>
||
<a href="@Url.Action("Delete", "SmartTech")">Delete</a>

<form action="@Url.Action("Registration", "SmartTech")" method="post" name="InputForm">
@{
    if (@Model.Name != null || @Model.Email != null || @Model.Email != null)
    {
        @Html.ValidationSummary()
        if (@Model.Errors != null)
        {
            @Model.Errors
        }
    }
}
<br />
<label>
    Fullname :</label><br />
<input id="text" name="Name" type="text" value="@Model.Name"/><br />
<label>
    Mobile :</label><br />
<input name="Mobile" type="text"  value="@Model.Mobile"/><br />
<label>
    Email :</label><br />
<input name="Email" type="text"  value="@Model.Email"/><br />
<label>
    School :</label><br />
<select name="School">
    <option></option>
    @{foreach (var item in ViewBag.Schools)
      {
        <option value="@item.Id">@item.Name</option>
      }
    }
</select><br />

<label>
    Workshop :</label><br />
<select name="Workshop">
    <option></option>
    @{foreach (var item in ViewBag.Workshops)
      {
         <option value="@item.Id">@item.Name</option>
      }
    }
</select><br />
<label>
    Interview :</label><br />
<select name="Interview" onfocus="AddOptionsList()">
    <option></option>
</select><br />
<button>
    Submit</button><br />
</form>
